<?php
/*
 * Reporting Facturation pour les Correcteurs
*
*
*/
class Orthographe_WordCounter_Adminhtml_ReportfacturationController extends Mage_Adminhtml_Controller_Action
{
	protected function _initAction()
	{
		$this->loadLayout()->_setActiveMenu('reviserordermanagement_menu/reviserordermanagement_gridreportfacturation')
		->_addBreadcrumb('reviserordermanagement Manager','reviserordermanagement Manager');
		return $this;
	}


	public function indexAction()
	{
		$this->loadLayout()
		->renderLayout();
		Mage::log("NPL -  ".get_class($this)." - Report Facturation index",Zend_Log::DEBUG);
	}

	/**
	 * Check currently called action by permissions for current user
	 *
	 * @return bool
	 */
	protected function _isAllowed()
	{
		return Mage::getSingleton('admin/session')->isAllowed('reviserordermanagement_menu/reviserordermanagement_gridreportfacturation');
	}

	
	public function exportCsvAction(){
		$fileName   = date("Ymd").'-ajuste_export_facturation.csv';
		$content    = $this->getLayout()->createBlock('Orthographe_WordCounter_Block_Adminhtml_Gridreportfacturation_Grid');

		$this->_prepareDownloadResponse($fileName, $content->getCsvFile());
	}

	public function exportExcelAction(){


		$fileName   = date("Ymd").'-ajuste_export_facturation.xls';
		$content    = $this->getLayout()->createBlock('Orthographe_WordCounter_Block_Adminhtml_Gridreportfacturation_Grid');

		$this->_prepareDownloadResponse($fileName, $content->getExcelFile("Ajuste ".date("Ymd")));
	}


}